package com.example.api.service.impl;

import com.example.api.dao.TollRuleDao;
import com.example.api.model.entity.TollRule;
import com.example.api.model.support.RespBean;
import com.example.api.service.TollRuleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TollRuleServiceImpl implements TollRuleService {

    @Resource
    private TollRuleDao tollRuleDao;

    @Override
    public List<TollRule> findAll() {
        return tollRuleDao.findAll();
    }

    @Override
    public RespBean update(TollRule tollRule) {
        if (tollRuleDao.updateByPrimaryKeySelective(tollRule) > 0) {
            return RespBean.success("更新成功");
        }
        return RespBean.error("更新失败");
    }

}
